<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>编辑订单设置表</title>
	<#include "/common/vue_resource.ftl">
	<style>
		.layui-input{width:240px;display:inline-block;margin-right:10px;}
		.layui-form-label{width:90px;}
	</style>
</head>
<body>
<div id="app" v-cloak>
	<div class="ui-form">
		<form class="layui-form" @submit.prevent="submitForm()" method="post" style="background:#fff;padding:30px;width:60%;margin:0 auto;">
			<div class="layui-form-item">
				<label class="layui-form-label">秒杀订单超过</label>
				<div class="layui-input-block">
					<input type="text" v-model="record.flashOrderOvertime" class="layui-input"/>（分钟）
					未付款，订单自动关闭
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">正常订单超过</label>
				<div class="layui-input-block">
					<input type="text" v-model="record.normalOrderOvertime" class="layui-input"/>（分钟）
					未付款，订单自动关闭
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">发货超过</label>
				<div class="layui-input-block">
					<input type="text" v-model="record.confirmOvertime" class="layui-input"/>（天）
					未收货，订单自动完成
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">订单完成超过</label>
				<div class="layui-input-block">
					<input type="text" v-model="record.finishOvertime" class="layui-input"/>（天）
					自动结束交易，不能申请售后
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">订单完成超过</label>
				<div class="layui-input-block">
					<input type="text" v-model="record.commentOvertime" class="layui-input"/>（天）
					自动五星好评
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<input type="submit" value="保存" class="layui-btn" />
				</div>
			</div>
		</form>
	</div>
</div>
<script>
	var app = new Vue({
		el: '#app',
		data: {
			showTypes: false,
			record : {
				flashOrderOvertime:'',
				normalOrderOvertime:'',
				confirmOvertime:'',
				finishOvertime:'',
				commentOvertime:'',
			},
		},
		mounted: function () {
			this.init();
			this.loadData();
		},
		methods: {
			init:function(){
				var that = this;
				/*laydate.render({elem: '#beginDate', type:'datetime', done:function (value) {
						that.record.beginDate = value;
					}});*/

			},
			loadData: function () {
				var that = this;
				$.http.post('${params.contextPath}/web/omsOrderSetting/query.json', {id: 'oms_order_setting'}).then(function (data) {
					if (!data.success) {
						$.message(data.message);
						return;
					}
					var item = data.data;
					for (var key in  that.record) {
						that.record[key] = item[key];
					}
				});
			},
			submitForm: function () {
				$.http.post('${params.contextPath}/web/omsOrderSetting/save.json', this.record).then(function (data) {
					if (!data.success) {
						$.message(data.message);
						return;
					}
					var alt = layer.alert(data.message || "操作成功", function () {
						//parent.app.loadData();
						//parent.layer.closeAll();
						layer.close(alt);
					});
				});
			},
		}
	});
</script>
</body>

</html>
